package cn.phantom.pooltest;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

@Slf4j(topic = "c.Test3")
public class Test3 {

    public static void main(String[] args) {

        Thread t1 = new Thread("t1") {
            @Override
            public void run() {
                try {
                    TimeUnit.SECONDS.sleep(2);
                    //Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };

        t1.start();
        System.out.println("t1 state: " + t1.getState()); //runnable
        try {
            TimeUnit.MILLISECONDS.sleep(500);
            //Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("t1 state: " + t1.getState()); //timed_waiting
        try {
            TimeUnit.SECONDS.sleep(5);
            //Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("t1 state: " + t1.getState()); //terminated

    }
}
